package com.training.admin.handler.support;

import org.apache.commons.io.FilenameUtils;

import com.demo2do.core.utils.StringUtils;

/**
 * @author downpour
 *
 */
public class FileStorage {
    
    private String path;
    
    private String name;
    
    private String extension;
    
    /**
     * The default constructor
     */
    public FileStorage() {
        
    }

    /**
     * 
     * 
     * @param path
     * @param name
     * @param extension
     */
    public FileStorage(String path, String name, String extension) {
        this.path = path;
        this.name = name;
        this.extension = extension;
    }
    
    /**
     * 
     * @param source
     * @return
     */
    public FileStorage extension(String source) {
        this.extension = FilenameUtils.getExtension(source);
        return this;
    }
    
    /**
     * 
     * @return
     */
    public String getFileName() {
        return StringUtils.connect(this.name, ".", this.extension);
    }
    
    /**
     * @return the path
     */
    public String getPath() {
        return this.path;
    }

    /**
     * @return the name
     */
    public String getName() {
        return this.name;
    }

    /**
     * @return the extension
     */
    public String getExtension() {
        return this.extension;
    }

    /**
     * @param path the path to set
     */
    public void setPath(String path) {
        this.path = path;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @param extension the extension to set
     */
    public void setExtension(String extension) {
        this.extension = extension;
    }

}
